package classloader;

import java.net.URL;
import java.net.URLClassLoader;

/**
 * 类加载器 demo5
 * 加载网络的类
 *
 * @author dingwen
 * @date 2021/08/29
 */
public class ClassLoaderDemo5 {
    public static void main(String[] args) throws Exception{
        URL url = new URL("http://localhost:8080/examples/");
        URLClassLoader urlClassLoader = new URLClassLoader(new URL[]{url});
        System.out.println("urlClassLoader.getParent() = " + urlClassLoader.getParent());
        Class clazz = urlClassLoader.loadClass("classloader.URLClassLoaderDemo");
        clazz.newInstance();

        // urlClassLoader.getParent() = sun.misc.Launcher$AppClassLoader@18b4aac2
        //URLClassLoaderDemo new instance
    }
}
